package org.dromara.assets.config;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.NoSuchElementException;

@Getter
@AllArgsConstructor
public enum TradePlanStatusEnum {
    STATE_1(1, "待触发"),
    STATE_2(2, "已触发"),
    STATE_21(21, "已赎回"),
    STATE_22(22, "已币币交换"),
    STATE_3(3, "已准备完成"),
    STATE_4(4, "已下单"),
    STATE_5(5, "待告警"),
    STATE_6(6, "已成交"),
    STATE_20(20, "已完成");

    private final Integer value;
    private final String description;

    public static TradePlanStatusEnum fromValue(Integer value) {
        return Arrays.stream(values())
                .filter(s -> s.value.equals(value))
                .findFirst()
                .orElseThrow(() -> new NoSuchElementException("Unknown state: " + value));
    }
}

